package com.weitu.workflow.definition.eventListener;

import org.fireflow.engine.EngineException;
import org.fireflow.engine.IProcessInstance;
import org.fireflow.engine.ITaskInstance;
import org.fireflow.engine.IWorkItem;
import org.fireflow.engine.IWorkflowSession;
import org.fireflow.engine.event.TaskInstanceEvent;
import org.fireflow.engine.persistence.IPersistenceService;
import org.fireflow.engine.taskinstance.DefaultTaskInstanceEventListener;
import org.fireflow.kernel.IActivityInstance;
import org.fireflow.kernel.INetInstance;
import org.fireflow.kernel.ISynchronizerInstance;
import org.fireflow.kernel.ITransitionInstance;
import org.fireflow.kernel.KernelException;
import org.fireflow.kernel.impl.Token;
import org.fireflow.model.ToolTask;


/**
 * ToolTask监听
 * 
 * @author xucc
 */
public class ToolTaskEventListener extends DefaultTaskInstanceEventListener {


	@Override
	protected void afterTaskInstanceCompleted(IWorkflowSession currentSession, IProcessInstance processInstance, ITaskInstance taskInstance) throws EngineException {
		boolean b = taskInstance.getTask() instanceof ToolTask;

			// 完成后判断是要向下走还是返回到上一环节
			super.afterTaskInstanceCompleted(currentSession, processInstance, taskInstance);
	}

	@Override
	protected void afterWorkItemCreated(IWorkflowSession currentSession, IProcessInstance processInstance, ITaskInstance taskInstance, IWorkItem workItem) throws EngineException {
		super.afterWorkItemCreated(currentSession, processInstance, taskInstance, workItem);
	}

	@Override
	protected void beforeTaskInstanceStart(IWorkflowSession currentSession, IProcessInstance processInstance, ITaskInstance taskInstance) throws EngineException {
		super.beforeTaskInstanceStart(currentSession, processInstance, taskInstance);
	}

	@Override
	public void onTaskInstanceEventFired(TaskInstanceEvent e) throws EngineException {
		
		super.onTaskInstanceEventFired(e);
	}
	
}
